<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>
        query httprequest
    </title>
    <script src="https://cdn.bootcss.com/jquery/3.0.0/jquery.min.js">
    </script>
    </meta>
</head>
<body>
<button id="bid">
    123123
</button>
<script type="text/javascript">
    $('#bid').click(function(){
        $.ajax({
            url:'http://auth.gylang.top/menu/findNavTree',//地址
            dataType:'json',//数据类型
            headers: {
                'token': "4f918552-a29c-46a7-a233-136655f46767",
                // 'content-type': 'application/json'
            },

            type:'GET',//类型
            timeout:2000,//超时
            //请求成功
            success:function(data,status){
                console.log(data)
                //alert(status);
            },
            //失败/超时
            error:function(XMLHttpRequest,textStatus,errorThrown){
                console.log(errorThrown)
                if(textStatus==='timeout'){
                    alert('請求超時');
                    setTimeout(function(){
                        alert('重新请求');
                    },2000);
                }
                //alert(errorThrown);
            }
        })
    })
</script>
</body>
</html>
